package com.hh.service.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hh.common.model.category.Category;
import com.hh.common.vo.CategoryOneLevelVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 分类表 Mapper 接口
 *  +----------------------------------------------------------------------
 *  | hh [ hh赋能开发者，助力企业发展 ]
 *  +----------------------------------------------------------------------
 *  | Copyright (c) 2016~2022 https://www.hh.com All rights reserved.
 *  +----------------------------------------------------------------------
 *  | Licensed hh并不是自由软件，未经许可不能去掉hh相关版权
 *  +----------------------------------------------------------------------
 *  | Author: hh Team <admin@hh.com>
 *  +----------------------------------------------------------------------
 */
public interface CategoryDao extends BaseMapper<Category> {

    @Select("select count(*) from eb_category where id = #{linkUrl} and type = 1")
    int selectCountByBanner(@Param("linkUrl") Integer linkUrl);

    @Select("select id,name,extra,sort from eb_category where mer_id = #{merId} and type = 1 and pid = 0 and status = 1 order by sort")
    List<CategoryOneLevelVo> getCategoryOneLevel(@Param("merId") String merId);
}
